<div class="container-fluid">
    <div class="wrapper">
        <div class="panel" id="nav">
            <div class="panel-heading"><h3 class="panel-title">收货明细报表</h3></div>
            <div class="panel-body">
                <form action="__URL__/recieve_details" method="get" id="form_search">
                    <div class="container-fluid">
                        <div class="col-sm-12 col-md-3  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">收货日期</span>
                                <input class="form-control form-date" type="text" name="recieve_time_from"
                                       style="cursor:pointer;" readonly>
                                <span class="input-group-addon"><span class="icon-calendar"></span></span>
                                <input class="form-control form-date" type="text" name="recieve_time_to"
                                       style="cursor:pointer;" readonly>

                            </div>
                        </div>
                        <div class="col-sm-12 col-md-2  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">供应商</span>
                                <input type="text" name="supplier" class="form-control" value="">
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-2 add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">采购员</span>
                                <input type="text" name="purchase_id" class="form-control" value="">
                            </div>
                        </div>

                        <div class="col-sm-12 col-md-2  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">是否是出口退税</span>

                                <select name="export_tax_rebate" id="export_tax_rebate" class="form-control">
                                    <option value="">全部</option>
                                    <option value="0">否</option>
                                    <option value="1">是</option>
                                </select>
                            </div>
                        </div>

                        <div class="col-sm-12 col-md-2  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">所属公司主体</span>
                                <select name="enterprise_dominant" id="enterprise_dominant" class="form-control">
                                    <option value="">--请选择--</option>
                                    <volist name="enterprise_dominant" id="val" key="num">
                                        <option value="{$num}">{$val}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-2  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">采购单号</span>
                                <input type="text" name="purchaseorder_id" class="form-control" value="">
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-2  add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">SKU</span>
                                <input type="text" name="sku" class="form-control" value="">
                            </div>
                        </div>

                        <div class="col-sm-12 col-md-2 add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">批次号</span>
                                <input type="text" name="batch_code" class="form-control" value="">
                            </div>
                        </div>
                        <br/>

                        <div class="col-sm-12 col-md-2 add-space">
                            <input class="btn btn-primary" type="submit" value="查询">
                            <input class="btn btn-primary" type="button" onclick="reset()" value="重置">
                            <input class="btn btn-success" type="button" value="下载" id="download">
                        </div>
                    </div>
                </form>
                <div class="clearfix"></div>
                <hr>

                <table class="table table-bordered" id="table_content" style="border-collapse:collapse;">
                    <thead>
                    <tr>
                        <th width="2%">序号</th>
                        <th width="6%">收货明细单号</th>
                        <th width="6%">采购单号</th>
                        <th width="6%">批次号</th>

                        <th width="8%">采购员</th>
                        <th width="6%">是否出口退税</th>
                        <th width="7%">SKU</th>
                        <th width="7%">中文名称</th>
                        <th width="5%">规格</th>

                        <th width="9%">储位</th>
                        <th width="8%">供应商</th>
                        <th width="3%">采购数量</th>
                        <th width="3%">到货量</th>
                        <th width="10%">收货日期</th>
                        <th width="4%">站点</th>
                        <th width="9%">公司主体</th>
                    </tr>
                    </thead>
                    <tbody id="div_content">
                    <volist name="data" id="val" key="num">
                        <tr>
                            <td>{$num}</td>
                            <td>{$val.id}</td>
                            <td>{$val.purchaseorder_id}</td>
                            <td>{$val.batch_code}</td>

                            <td>{$val.purchase_id}</td>
                            <td>{$val.export_tax_rebate}</td>
                            <td>{$val.sku}</td>
                            <td>{$val.sku_name}</td>
                            <td>{$val.sku_standard}</td>
                            <td>{$val.storage_position}</td>
                            <td>{$val.supplier}</td>
                            <td>{$val.purchase_quantity}</td>
                            <td>{$val.arrival_quantity}</td>
                            <td>{$val.recieve_time}</td>
                            <td>{$val.site_id}</td>
                            <td>{$val.enterprise_dominant}</td>
                        </tr>
                    </volist>
                    </tbody>
                    <tfoot>
                    <tr>
                        <td>合计</td>
                        <td colspan="15"><span id="sum_arrival_quantity">当前页总到货量:<font color="red">{$sum}</font></span></td>
                    </tr>
                    </tfoot>
                </table>
                <div class="clearfix clear"></div>
                <div class="row">
                    <div class="col-md-6 pull-left">
                        <label>每页 20 条记录
                            显示 1 到 20 项，共 {$count}项</label>
                    </div>
                    <div class="col-md-6">
                        <div class="page pull-right" style="padding: 0;margin: 0">
                            {$page}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        $("input[name='sku']").val("<?php  echo $_GET['sku'];?>");
        $("select[name=export_tax_rebate]").val("<?php echo $_GET['export_tax_rebate']?>");
        $("input[name='supplier']").val("<?php echo $_GET['supplier'];?>");
        $("input[name='purchase_id']").val("<?php echo $_GET['purchase_id'];?>");
        $("input[name='recieve_time_from']").val("<?php  echo $_GET['recieve_time_from'];?>");
        $("input[name='recieve_time_to']").val("<?php  echo $_GET['recieve_time_to'];?>");
        $("select[name='enterprise_dominant']").val("<?php  echo $_GET['enterprise_dominant'];?>");
        $("input[name='purchaseorder_id']").val("<?php echo $_GET['purchaseorder_id'];?>");

        $("input[name='batch_code']").val("<?php  echo $_GET['batch_code'];?>");
    });

    /**
     * 重置
     * */
    function reset() {
        $('#form_search').find('input').val('');
        $('#form_search').find('select').val('');
    }
    /**
     * 下载
     */
    $("#download").click(function () {
        var param = '';
        var sku = $("input[name='sku']").val();
        var purchase_id = $("input[name='purchase_id']").val();
        var purchaseorder_id = $("input[name='purchaseorder_id']").val();
        var supplier = $("input[name='supplier']").val();
        var recieve_time_from = $("input[name='recieve_time_from']").val();
        var recieve_time_to = $("input[name='recieve_time_to']").val();
        var enterprise_dominant = $("select[name='enterprise_dominant']").val();
        var export_tax_debate = $("select[name='export_tax_debate']").val();

        var batch_code = $("input[name='batch_code']").val();
        if ($.trim(batch_code) != '') {
            param += "&batch_code=" + batch_code;
        }

        if ($.trim(sku) != '') {
            param += "&sku=" + sku;
        }
        if ($.trim(purchase_id) != '') {
            param += "&purchase_id=" + purchase_id;
        }
        if ($.trim(purchaseorder_id) != '') {
            param += "&purchaseorder_id=" + purchaseorder_id;
        }
        if ($.trim(supplier) != '') {
            param += "&supplier=" + supplier;
        }
        if ($.trim(recieve_time_from) != '') {
            param += "&recieve_time_from=" + $.trim(recieve_time_from);
        }
        if ($.trim(recieve_time_to) != '') {
            param += "&recieve_time_to=" + $.trim(recieve_time_to);
        }
        if ($.trim(enterprise_dominant) != '') {
            param += "&enterprise_dominant=" + $.trim(enterprise_dominant);
        }
        if ($.trim(export_tax_debate) != '') {
            param += "&export_tax_debate=" + $.trim(export_tax_debate);
        }
        if (param != '') {
            param = '?' + param.substr(1);
        }
        window.location.href = '__URL__/recieve_details_download' + param;
    });

</script>






